<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<titel>客户列表</titel>
<script type="text/javascript" src='<{$ipath}>app/hotel/js/My97DatePicker/WdatePicker.js'></script>
<script src="<{$ipath}>app/hotel/js/jquery-1.9.1.min.js"></script>
<style>
*{
	margin: 0px;
	padding: 0px;
	list-style-image: none;
	list-style-type: none;
}
body{
	font-family: "微软雅黑", "黑体", "宋体";
	font-size: 12px;
	font-weight: normal;
	color: #333;
	line-height: 20px;
} 
a{cursor:pointer;}
.listtab{
	background-color: #369;
}
.listtab th{
	background-color: #FFF;
	text-align: center;
}
.listtab td{
	background-color: #FFF;
}
</style>
</head>
<body>
<form method="post" action="">
    搜悦号：<input type="text" name="username" value="<{if !empty($oldpar.username)}><{$oldpar.username}><{/if}>"/>
    客户名称：<input type="text" name="clientname" value="<{if !empty($oldpar.clientname)}><{$oldpar.clientname}><{/if}>"/>
    应用名称：<input type="text" name="appname" value="<{if !empty($oldpar.appname)}><{$oldpar.appname}><{/if}>"/>
    版本：<select name="hytype">
        <option value=""<{if empty($oldpar.hytype)}> selected='selected'<{/if}>>请选择</option>
        <{foreach from=$groups item=n key=m}>
            <option value="<{$m}>"<{if !empty($oldpar.hytype) && $oldpar.hytype==$m}> selected='selected'<{/if}>><{$n}></option>
        <{/foreach}>
        </select>
    过期时间：<input type="text" name="stime" value="<{if !empty($oldpar.stime)}><{$oldpar.stime}><{/if}>" onClick="WdatePicker({startDate:'',dateFmt:'yyyy-MM-dd HH:mm'})"/> ~
              <input type="text" name="etime" value="<{if !empty($oldpar.etime)}><{$oldpar.etime}><{/if}>" onClick="WdatePicker({startDate:'',dateFmt:'yyyy-MM-dd HH:mm'})"/>
    <input type="submit" value="查询"/>
</form>
<br/><br/>
<table border="0" cellpadding="0" cellspacing="1" class="listtab">
    <tr>
        <th>id</th>
        <th>搜悦号</th>
        <th>客户名称</th>
        <th>应用名称</th>
        <th>token</th>
        <th>版本</th>
        <th>开通时间</th>
        <th>结束时间</th>
        <th>三级域名</th>
        <th>操作</th>
    </tr>
    <{foreach from=$lists item=v key=k}>
    <tr>
        <td><{$v.id}></td>
        <td><{$v.username}></td>
        <td><{$v.clientname}></td>
        <td><{$v.appname}></td>
        <td><{$v.token}></td>
        <td><{$v.gname}></td>
        <td><{date('Y-m-d H:i:s',$v.start_time)}></td>
        <td><{date('Y-m-d H:i:s',$v.end_time)}></td>
        <td><{$v.three_domain}></td>
        <td><a href="<{$basehost}>?g=user&m=member&a=edituser&id=<{$v.id}>">编辑</a>
        <{if $v.status==1}>
            <a href="javascript:void(0);" onclick="setStatus(<{$v.id}>)" stat="0" id="stat_<{$v.id}>">禁用</a>
        <{else}>
            <a href="javascript:void(0);" onclick="setStatus(<{$v.id}>)" stat="1" id="stat_<{$v.id}>">启用</a>
        <{/if}>
        </td>
    </tr>
    <{/foreach}>
</table>
<script type="text/javascript">
    function setStatus(uid){
        var url = "<{$basehost}>?g=user&m=member&a=setStatus";
        var type = $('#stat_'+uid).attr('stat');
        //ajax操作
        $.post(url, {uid: uid, type: type}, function(data){
            if(data.status)
            {
                alert('操作成功');
                if(type==1){
                    $('#stat_'+uid).text('禁用');
                    $('#stat_'+uid).attr('stat',0);
                }else{
                    $('#stat_'+uid).text('启用');
                    $('#stat_'+uid).attr('stat',1);
                }
            }else{
                alert('操作失败');
            }
        }, 'json');
    }

</script>
</body>
</html>